package com.ctalk.base.service.impl;

import java.util.List;
import com.ctalk.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ctalk.base.mapper.WxuserMapper;
import com.ctalk.base.domain.Wxuser;
import com.ctalk.base.service.IWxuserService;

/**
 * 微信用户Service业务层处理
 * 
 * @author wanghuan
 * @date 2025-08-04
 */
@Service
public class WxuserServiceImpl implements IWxuserService 
{
    @Autowired
    private WxuserMapper wxuserMapper;

    /**
     * 查询微信用户
     * 
     * @param wxId 微信用户主键
     * @return 微信用户
     */
    @Override
    public Wxuser selectWxuserByWxId(Long wxId)
    {
        return wxuserMapper.selectWxuserByWxId(wxId);
    }

    /**
     * 查询微信用户列表
     * 
     * @param wxuser 微信用户
     * @return 微信用户
     */
    @Override
    public List<Wxuser> selectWxuserList(Wxuser wxuser)
    {
        return wxuserMapper.selectWxuserList(wxuser);
    }

    /**
     * 新增微信用户
     * 
     * @param wxuser 微信用户
     * @return 结果
     */
    @Override
    public int insertWxuser(Wxuser wxuser)
    {
        wxuser.setCreateTime(DateUtils.getNowDate());
        return wxuserMapper.insertWxuser(wxuser);
    }

    /**
     * 修改微信用户
     * 
     * @param wxuser 微信用户
     * @return 结果
     */
    @Override
    public int updateWxuser(Wxuser wxuser)
    {
        wxuser.setUpdateTime(DateUtils.getNowDate());
        return wxuserMapper.updateWxuser(wxuser);
    }

    /**
     * 批量删除微信用户
     * 
     * @param wxIds 需要删除的微信用户主键
     * @return 结果
     */
    @Override
    public int deleteWxuserByWxIds(Long[] wxIds)
    {
        return wxuserMapper.deleteWxuserByWxIds(wxIds);
    }

    /**
     * 删除微信用户信息
     * 
     * @param wxId 微信用户主键
     * @return 结果
     */
    @Override
    public int deleteWxuserByWxId(Long wxId)
    {
        return wxuserMapper.deleteWxuserByWxId(wxId);
    }

    /**
     * 通过OpenID查询微信用户信息
     * @param openid
     * @return
     */
    @Override
    public Wxuser selectUserOpenID(String openid) {
        return wxuserMapper.selectUserOpenID(openid);
    }
}
